/*
 * Project Name: cms_manager
 * File Name: SinglePageService.java
 * Copyright: ZKTeco Corporation 2015
 * Description: TODO 请在此处添加对本文件的描述
 * Creator: Administrator
 * Create Date: 2015年3月18日 下午3:50:58
 */
package com.shishuo.cms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shishuo.cms.dao.SinglePageDao;
import com.shishuo.cms.entity.SinglePageEntity;
import com.shishuo.cms.entity.vo.PageVo;

/**
 * 
 * @since 2015年3月18日 下午3:50:58
 */
@Service
public class SinglePageService extends BaseService<SinglePageEntity, Long>
{
	private SinglePageDao singlePageDao;

	@Autowired
	public void setSinglePageDao(SinglePageDao singlePageDao)
	{
		super.setBaseDao(singlePageDao);
		this.singlePageDao = singlePageDao;
	}
	public PageVo<SinglePageEntity> getAllListPage(int pageNum) throws Exception{
		PageVo<SinglePageEntity> pageVo = new PageVo<SinglePageEntity>(pageNum);
		List<SinglePageEntity> list = singlePageDao
				.getAllListPageByClassId(pageVo.getOffset(), pageVo.getRows(),0);
		pageVo.setList(list);
		pageVo.setCount(singlePageDao.getAllListCountByClassId(0));
		return pageVo;
	}
	public PageVo<SinglePageEntity> getAllListPageByClassId(int pageNum, long classId) throws Exception {
		PageVo<SinglePageEntity> pageVo = new PageVo<SinglePageEntity>(pageNum);
		List<SinglePageEntity> list = singlePageDao
				.getAllListPageByClassId(pageVo.getOffset(), pageVo.getRows(),classId);
		pageVo.setList(list);
		pageVo.setCount(singlePageDao.getAllListCountByClassId(classId));
		return pageVo;
	}
}
